<?php 
// +----------------------------------------------------------------------
// | OneKeyAdmin [ Believe that you can do better ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2023 http://onekeyadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: MUKE <513038996@qq.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);

namespace app\api\middleware;
/**
 * 用户鉴权（按需引入中间件）
 */
class AuthCheck
{
    public function handle($request, \Closure $next)
    {
        if (empty($request->userId)) {
            return json(['status'=>'login', 'message'=> '请登录后操作！']);
        }
        // 下一步
        return $next($request);
    }
}